<%@ page import="javax.sql.*"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
    <h1>Review Process Has <font color="red">Not Started</font></h1>
    <!-- in case validation fails -->
    <html:errors />
    
    <% 
    // print error messages
    String error = (String)request.getAttribute("reviewError"); 
    if(error != null){
        out.print(error);
        request.getSession(false).setAttribute("reviewError", null);
    }
    
    // print if successful insertion
    if(request.getParameter("success") != null && request.getParameter("success").equals("true")){
        out.print("Successfully subbmitted student<br>");
    }
    
    %>
    Current Reviewers (number of reviewers: <% out.println(  request.getAttribute("numReviewers")  ); %>)
    
      
      <%
          // Get the studentsRowSet
          RowSet crsReviewers = (RowSet) request.getAttribute("crsReviewers");
        
          out.print("<table border=1>");
          // Iterate over the RowSet
          while (crsReviewers.next()) {
              out.print("<tr> <td>");
              out.print(crsReviewers.getString("username") + "</td>");
              %>
              
             <html:form action="/chair/deleteReviewer">
                    <%
                    String id = Integer.toString(crsReviewers.getInt("reviewerid"));
                    out.print("<input type=\"hidden\" name=\"id\" value=\"" + id  + "\" />");
                    %>
                    <td><html:submit value="Delete" /></td>  
             </html:form>
              
  
              <% 
          }
          out.print("</table>");
      %>
      <!-- insertReviewer.do -->
    
      Insert new reviewer:
      <table><tr><td>User Name</td><td>Password</td></tr>
      <html:form action="/chair/insertReviewer">
                    <tr>
                    <td><html:text property="username" size="15" /></td>
                    <td><html:password property="password" size="15" /></td>
                    <td><html:submit value="Insert" /></td>
                    <td><html:reset /></td> </tr>
      </html:form>
      </table>
    <a href="startReview.do">Start Review</a>
</body>
</html>